﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Max.PH4_2102A.Shopping.Domain
{
    /// <summary>
    /// 订单主表
    /// </summary>
    [Table("tb_order_master")]
    public class OrderMasterEntity : AuditField
    {
        //订单编号、下单时间、订单价格（应付金额）、
        //收货地址、收货人姓名、收货人电话、
        //折扣金额（不是折扣券）、订单操作-状态（已发货、未发货、退货）、
        //付款方式、付款时间、实付金额
        //配送方式、备注

        public Guid Id { get; set; }

        /// <summary>
        /// 订单号（用是雪花ID） ---4分
        /// </summary>
        public string OrderNo { get; set; } = new Snowflake.Core.IdWorker(1, 1).NextId().ToString();

        public DateTime OrderTime { get; set; } //下单时间
        public decimal OrderAmount { get; set; }//订单总金额

        public Guid MemberId { get; set; } //会员ID，表示 是谁下的单
        public string RecivedAddress { get; set; } //收货地址、收货人姓名、收货人电话
        public string RecivedPhone { get; set; }
        public string RecivedName { get; set; }

        public decimal? RateAmount { get; set; } = 0; //折扣金额
        public OrderStateEnum OrderState { get; set; } = OrderStateEnum.待付款;  //订单状态 ---枚举

        public OrderPayTypeEnum? PayType { get; set; }//支付类型
        public DateTime? PayTime { get; set; }//付款时间
        public decimal? PayAmount { get; set; }//付款金额

        public string? SendType { get; set; } //配送方式
    }
}
